//-----------------------------------------------------------------------
// <copyright file="PlacePostService.cs" company="FetCo">
//     Copyright (c) FetCo. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------	

using System;
using System.Collections;
using FetCo.Framework;
using ADESSA.Entities;
using ADESSA.Data;
    
namespace ADESSA.Business
{   
	/// <summary>
	/// 
	/// </summary> 
    public class PlacePostService
    {
        #region PlacePost

        public static void CreatePlacePost(PlacePost placePost)
        {            
            try
            {
                PlacePostDAO placePostDAO = new PlacePostDAO();
                placePostDAO.CreatePlacePost(placePost);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessCreatePlacePostException, ex);
            }
        }        

        public static void UpdatePlacePost(PlacePost placePost)
        {            
            try
            {
                PlacePostDAO placePostDAO = new PlacePostDAO();
                placePostDAO.UpdatePlacePost(placePost);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessUpdatePlacePostException, ex);
            }
        }        

        public static void DeletePlacePost(long placeId)
        {            
            try
            {
                PlacePostDAO placePostDAO = new PlacePostDAO();
                placePostDAO.DeletePlacePost(placeId);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessDeletePlacePostException, ex);
            }
        }
        
        public static PlacePost GetPlacePost(long placeId)
        {            
            try
            {
                PlacePostDAO placePostDAO = new PlacePostDAO();
                return placePostDAO.GetPlacePost(placeId);                
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetPlacePostException, ex);
            }
        }                

        public static PlacePostCollection GetPlacePostList(PlacePostColumns orderBy, OrderDirection orderDirection)
        {            
            try
            {
                PlacePostDAO placePostDAO = new PlacePostDAO();
                return placePostDAO.GetPlacePostList(orderBy, orderDirection);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetPlacePostListException, ex);
            }
        }        

        public static PlacePostCollection GetPlacePostList(PlacePostColumns orderBy, OrderDirection orderDirection, int page, int pageSize, out int totalRecords)
        {            
            try
            {
                PlacePostDAO placePostDAO = new PlacePostDAO();
                return placePostDAO.GetPlacePostList(orderBy, orderDirection, page, pageSize, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetPlacePostListException, ex);
            }
        }        

	    public static PlacePostCollection GetPlacePostListByParam(object orderBy, OrderDirection orderDirection,string where)
        {            
            try
            {
                PlacePostDAO placePostDAO = new PlacePostDAO();
                return placePostDAO.GetPlacePostListByParam(orderBy, orderDirection,where);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetPlacePostListException, ex);
            }
        }        

        public static PlacePostCollection GetPlacePostListByParam(object orderBy, OrderDirection orderDirection, int page, int pageSize,string Criteria, out int totalRecords)
        {            
            try
            {
                PlacePostDAO placePostDAO = new PlacePostDAO();
                return placePostDAO.GetPlacePostListByParam(orderBy, orderDirection, page, pageSize,Criteria, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetPlacePostListException, ex);
            }
        }        

        #endregion
    }
}